<?php
if (count($list['list'])) {
    $i = 0;
    foreach ($list['list'] as $_k=>$_v) {
        
        unset($list['list'][$_k]['pricein']); //去掉进价
        unset($list['list'][$_k]['price2']);
        unset($list['list'][$_k]['price3']);
        unset($list['list'][$_k]['views']);
        unset($list['list'][$_k]['click']);
        unset($list['list'][$_k]['sig_click']);
        unset($list['list'][$_k]['groupkey']);
        unset($list['list'][$_k]['groupvalue']);
        unset($list['list'][$_k]['issale']);
        unset($list['list'][$_k]['updated']);
        unset($list['list'][$_k]['stocked']);
        unset($list['list'][$_k]['title']);

        foreach ($_v as $k=>$v) {
            if ($k == 'pic') {
                //中图片不存在替换为小图片
                if (!file_exists(ROOT.$v['m'])) $v['m'] = str_replace('.gif', '.jpg', $v['m']);
                if (!file_exists(ROOT.$v['m'])) $v['m'] = $v['s'];
                $list['list'][$_k][$k]['s'] = 'http://www.loopo.cn'.$v['s'];
                $list['list'][$_k][$k]['m'] = 'http://www.loopo.cn'.$v['m'];
            }

            if ($k == 'created') $list['list'][$_k][$k] = date('r', $v);

            $items[$i][$k] = preg_replace('|src=(["\']?)/|i', "src=$1http://www.loopo.cn/", $list['list'][$_k][$k]);
        }
    }

    $result['response'] = $list['list'];
    $result['stat'] = "ok";

} else {
    $result['stat'] = "fail";
}

echo serialize($result);
?>